#! /bin/bash

help_end() {
    echo "Usage: $0 [-r] <files/dirs>"
    echo '       rm with interactive and verbose modes on.'
    echo "       Specify -r to also enable recursive mode."
    exit 0
}

if [[ $# = 0 ]]; then
    help_end
fi

declare -a ALL ADDITIONAL_FLAG

for f in "$@"
do
    if [[ $f = '-r' ]]; then
        ADDITIONAL_FLAG+=('-r')
    elif [[ $f = -* ]]; then
        help_end
    else
        ALL+=("$f")
    fi
done

rm -iv "${ALL[@]}"
